package com.ericsson.eritask.dao.impl;

import java.util.List;

import javax.persistence.EntityManager;
import javax.persistence.PersistenceContext;
import javax.persistence.TypedQuery;

import org.springframework.stereotype.Repository;
import org.springframework.transaction.annotation.Transactional;

import com.ericsson.eritask.dao.UserTaskDAO;
import com.ericsson.eritask.domain.User;
import com.ericsson.eritask.domain.UserTask;

@Repository
public class UserTaskDaoImpl implements UserTaskDAO{

	
	@PersistenceContext
	EntityManager entityManager;
	
	@Transactional
	@Override
	public List<UserTask> getUsertaskDtls(String signum) {


		List<UserTask> userTaskList = null;
		
		TypedQuery<UserTask> query11 = entityManager.createQuery("select u from UserTask u where u.user.signum = ?1 ",UserTask.class );
		query11.setParameter(1,signum );
		
		
		userTaskList = query11.getResultList();
		System.out.println("userTaskList:"+userTaskList.size());
		for(UserTask  userTask:userTaskList ){
			System.out.println("UserTask id :"+userTask.getTask().getTaskId());
		}
		
		return userTaskList;
	}

}
